#pragma once

#include <cocos2d.h>
#include "HealthBar.h"
#include "BaseObject.h"
#include "BaseStrategy.h"
#include "pugixml.hpp"

USING_NS_CC;
using namespace pugi;

class Bullet;
class BaseStrategy;

class Enemy : public BaseObject
{
public:
	Enemy(void);
	~Enemy(void);

	virtual bool init();
	virtual void onShot(Bullet* bullet);
	virtual void updatePosition(float dt);

	virtual void onEnter();
	/**
	Parse ai template
	xml_node template:
	<Id>strategy_bosslvl1</Id>
	<Data></Data>
	*/
	virtual void parseAi(xml_node node);

	/**
	Parse items template
	- arr: list of CCDictionary in map. CCDictionary contains:
		+ CCString: id
		+ string: xml_node data
	*/
	virtual void parseItem(CCArray* arr);
	virtual void shoot( Bullet* bullet );
	virtual void onDie();
	void drawShawdon();
	void visitShadow();

	void reset();

	CC_SYNTHESIZE_RETAIN(CCString*, _id, Id);
	CC_SYNTHESIZE(CCPoint, _velocity, Velocity);
	CC_SYNTHESIZE_RETAIN(CCArray*, _listBulletIdShot, BulletIdShot);
	CC_SYNTHESIZE_RETAIN(CCArray*, _listItem, Items);
	CC_SYNTHESIZE_RETAIN(HealthBar*, _healthBar, HealthBar);
	CC_SYNTHESIZE_RETAIN(CCArray*, _listStrategy, Strategies);
	CC_PROPERTY(int, _health, Health);
	CC_PROPERTY(int, _maxHealth, MaxHealth);
	CC_SYNTHESIZE(int, _score, Score);

	CREATE_FUNC(Enemy);

	

};

